<?php
declare (strict_types = 1);

namespace app\sk\tpl;
use app\core\Res;


class SearchInfo extends Base
{

   public function toForm(){
        $p=[
            'xinhao'=>'*',
            'titleName'=>'name',
            'inputType'=>'text',
            'inputName'=>'a1',
            'verType'=>'lay-verType="tips"',
            'verify'=>'lay-verify="required" required',
            'onkeyup'=>$this->onKeyupMoney(),
            'disabled'=>'disabled',
        ];
        echo $this->formInput($p);
        echo $this->formOption($p);
   }

   public function view(){
        echo $this->header();
        $hiddenParams=['relation_id','relation_type'];
        $hiddenInput=$this->hiddenInputList($hiddenParams);
        $inputList='';
        $buttonList='';
        $dateJsList='';
        $showLayerJsList='';
        $inputParams=[
            'xinhao'=>'',
            'titleName'=>'公司名称',
            'inputType'=>'text',
            'inputName'=>'company_name',
            'verType'=>'',
            'verify'=>'',
            'onkeyup'=>'',
            'disabled'=>'',
        ];
        $inputList .=$this->formInput($inputParams);
        $inputParams=[
            'xinhao'=>'',
            'titleName'=>'关键字',
            'inputType'=>'text',
            'inputName'=>'keywords',
            'verType'=>'',
            'verify'=>'',
            'onkeyup'=>'',
            'disabled'=>'',
        ];
        $inputList .=$this->formInput($inputParams);

        $inputParams=[
            'xinhao'=>'',
            'titleName'=>'创建时间',
            'inputName'=>'createDateSel',
            'verType'=>'',
            'verify'=>'',
            'onkeyup'=>'',
            'disabled'=>'',
        ];
        $inputList .=$this->selectDate1($inputParams);
        $dateJsList.=$this->selectJsDate1($inputParams).PHP_EOL;

        $buttonParams=[
            [
                'titleName'=>'搜索',
                'buttonName'=>'mxTbSearch',
                'buttonIcon'=>'&#xe615;',
            ],
            [
                'titleName'=>'重置',
                'buttonName'=>'mxReset',
                'buttonIcon'=>'&#xe669;',
            ],
        ];
        
        $buttonList .=$this->formSearchButton($buttonParams);
        $searchForm1=[
            'FormId'=>'myForm',
            'hiddenInput'=>$hiddenInput,
            'inputList'=>$inputList,
            'buttonList'=>$buttonList,
        ];
        $formFrame=[
            'FormInfo'=>$this->searchForm1($searchForm1),
            'TableInfo'=>$this->searchTable1(['TableId'=>'myTable']),
        ];
        echo $this->formFrame1($formFrame);

        $FunInfo=
<<<EOF
$("#relation_id").val(selectData.id);
$("#company_name").val(selectData.company_name);
$("#relation_type").val(selectData.relation_type);
$("#customer_name").val('');
EOF;
        $companyFunParams=[
            'FunName'=>'CompanyData',
            'FunInfo'=>$FunInfo
        ];
        $companyFun=$this->acceptFunction1($companyFunParams);

        $FunInfo=
<<<EOF
$("#relation_id").val(selectData.id);
$("#customer_name").val(selectData.customer_name);
$("#relation_type").val(customer_relation_type);
$("#company_name").val('');
EOF;
        $customerFunParams=[
            'FunName'=>'CustomerData',
            'FunInfo'=>$FunInfo
        ];
        $customerFun=$this->acceptFunction1($customerFunParams);

        $jsParams=[
            'tableDataArray'=>['tableData','tableData1'],
            'acceptFunction'=>[$companyFun,$customerFun],
            'dateJs'=>$dateJsList,
            'showLayerJs'=>$showLayerJsList,
        ];
        echo $this->layuijs($jsParams);
   }

}